package java67_5;

import java.util.Scanner;

public class Shoppingjiesuan {

	public static void main(String[] args) {
		// ppt上最后 ,购物结算那题,折扣统一是8折
		System.out.println("***************************");
		System.out.println("请选择购买的商品编号：");
		System.out.println("1.T恤\t\t2.网球鞋\t\t3.网球拍");
		System.out.println("***************************");
		Scanner in = new Scanner(System.in);
		int bianhao;
		int shuliang;
		String shifou;
		double price1 = 0, price2 = 0, price3 = 0;
		double discount = 0.8, total = 0, price, money;
		do {
			System.out.print("请输入商品编号：");
			bianhao = in.nextInt();
			switch (bianhao) {
			case 1: {
				System.out.print("请输入购买数量：");
				shuliang = in.nextInt();
				price1 += 245.0 * shuliang;
				System.out.println("T恤￥245.0\t" + "数量" + shuliang + "\t" + "合计￥" + price1);
				break;
			}
			case 2: {
				System.out.print("请输入购买数量：");
				shuliang = in.nextInt();
				price2 += 570.0 * shuliang;
				System.out.println("网球鞋￥570.0\t" + "数量" + shuliang + "\t" + "合计￥" + price2);
				break;
			}
			case 3: {
				System.out.print("请输入购买数量：");
				shuliang = in.nextInt();
				price3 += 320.0 * shuliang;
				System.out.print("网球拍￥320.0\t" + "数量" + shuliang + "\t" + "合计￥" + price3);
				break;
			}
			default: {
				System.out.println("输入编号有误，请重新输入!");
				break;
			}
			}
			System.out.print("是否继续（y/n）");
			shifou = in.next();
		} while (shifou.equals("y"));
		System.out.println("折扣：" + discount);
		total = price1 + price2 + price3;
		total *= discount;
		System.out.println("应付金额：" + total);
		System.out.print("实付金额：");
		price = in.nextDouble();
		money = price - total;
		System.out.println("找钱：" + money);
	}

}
